/*
**  File: AquaTypes_Assign.h
**
** New datatypes defined for AquaAssign.c module
** jfd @ Tue Sep  3 17:42:19 WDT 1996
**
** adapted by tr, Dec 11, 1997
**
*/

#ifndef TYPES_ASSIGN_h
#define TYPES_ASSIGN_h

/* These numbers are just for formating the output, should they cause a real
 * error then they are easily adjusted but don't forget to adjust the output
 * formating as well.
 */

#define MAX_MODELS		    99                      /* Maximum models */
#define MAX_RESTRAINTS		    99999               /* Maximum restraints */
#define MAX_TRIPLETS		    999                   /* Maximum triplets */
#define MAX_RESTRAINTS_PER_TRIPLET  99 /* Max restraints involved per triplet */

/*
 * Some other numbers
 */

#define ENERGY_ABS_CRITERIUM	    0.1  /* Abs dif A^2 per model per triplet */
#define ENERGY_REL_CRITERIUM	    0.0              /* Percentage difference */
#define MODEL_CRITERIUM		    0.0     /* Perc. Models in favored state  */
#define MAX_STATES		    2          /* The # of states of swapping */
#define MAX_ATOMS_TRIPLET	    3
#define SMALL_POS_DOUBLE_NUMBER	    1.0E-10        /* A small positive number */
#define BAD_CORRECT		    9.9         /* A bad value for correction */
#define TWO_PROTON_RADII	    1.8        /* Two times a hydrogen radius */
#define NO_LOWER_BOUND_TOKEN	    -1.0      /* When no lower bounds present */

#define F_OPEN_PROTECTED(fp,FileName,Mode) \
{ \
    fp = fopen(FileName,Mode); \
    if ( fp == NULL ) { \
	printf("\n Could not open '%s' in '%s' mode, aborting...\n", \
	    FileName, Mode); \
	    nrerror("Error in macro: F_OPEN_PROTECTED"); \
    } \
}

enum dtype { unic, not_unic };             /* unic if both atoms are assigned */ 

typedef struct {
    int     P, Q, X;                     /* Index to the atom in the Mol list */

    Boolean assigned;          /* Unassigned will cause the X atom to be used */
    Boolean ext_assigned;                      /* By the Aqua assignment file */
    Boolean swapped;           /* wrt DistInfl in concert with Extra_Distinfl */
    int	    ass_idx;	            /* First assigned -> 1, not assigned -> 0 */
    
    int	    restrt_index[MAX_RESTRAINTS_PER_TRIPLET];   /* Holding restraints */
    int	    restrt_count;
    
    double  int_energy[MAX_RESTRAINTS_PER_TRIPLET]; 
    int	    int_num_mdl_fav;        /* Number of models in favoring the state */
    Boolean int_ass;                                     /* assigned internal */
    Boolean int_fav_swap;                                /* Initial fase swap */

} Triplet;


typedef struct                             /* Extra Distance information list */
{
    Boolean boo_A, boo_B;	   /* assignment status of individual members */ 
    int	    ass_A, ass_B;   /* like in Distinfl; now holding internal assign. */
    double  cor_A, cor_B;                     /* Corrections for pseudo-atoms;*/
						 /* only used if not assigned */
}
Extra_Distinfl;


typedef struct {
    int     S, T;                     /* Index to the shells S and T
					 0 means unassigned */
} Shells;

#endif
